% ECGSAVE       Plotting continuous filtered ECG signals
%
% Function:     Plotting ECG data and print it into separated windows
%               outside GUI
%
% Copyright: Group 8
% Modified at 20th Oct 2010
%-------------------------------------------------------------------------
function Data_staticplot2 = ecgsave(data)
%% Calculating the real magnitude of signal
% Chebyshev ratio : 5.46e4 / 3.36
% Data point to Volts: 5/65536
% Total Gain: 1600
data = data* 5.46e4 / 3.36 * 5/65536 / 1.6;
figure(2);
% Time array generation
t = (0:length(data)-1)/553.6;

%% Subplot 1: 3-17s
subplot(411);
plot(t,data);
xlim([3,20]);
grid on
% Labeling axes 
ylabel('Magnitude (mV)')
xlabel('time / s')

%% Subplot 2: 21-38s
subplot(412);
plot(t,data);
xlim([21,38]);
grid on
% Labeling axes 
ylabel('Magnitude (mV)')
xlabel('time / s')

%% Subplot 3: 39-55s
subplot(413);
plot(t,data);
xlim([39,55]);
grid on
% Labeling axes 
ylabel('Magnitude (mV)')
xlabel('time / s')

%% Subplot 4: 56-72s
subplot(414);
plot(t,data);
xlim([56,72]);
grid on
% Labeling axes 
ylabel('Magnitude (mV)')
xlabel('time / s')

%% Setting artistic properties
set(findobj('Type','line'),'Color','r','linewidth',2)
%set(gca,'Color','k')